package com.wutianyi.datastore;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.jolbox.bonecp.BoneCP;
import com.jolbox.bonecp.BoneCPConfig;

public class Main
{
    public static void main(String[] args) throws SQLException
    {

        BoneCPConfig config = new BoneCPConfig();

        config.setJdbcUrl("jdbc:mysql://localhost:3307/ds?characterEncoding=utf8");
        config.setUsername("root");
        config.setPassword("860728");
        config.setMinConnectionsPerPartition(5);
        config.setMaxConnectionsPerPartition(10);
        config.setPartitionCount(1);
        BoneCP connectionPool = new BoneCP(config);

        Connection conn = connectionPool.getConnection();
        DatabaseMetaData metaData = conn.getMetaData();
        ResultSet rs = metaData.getPrimaryKeys("ds", "ds", "__kind__indexes__value");
        while (rs.next())
        {
            System.out.println(rs.getString("COLUMN_NAME"));
        }
        rs = metaData.getColumns("ds", "ds", "__kind__indexes__value", "i");
        while (rs.next())
        {
            System.out.println(rs.getString("COLUMN_NAME"));
            System.out.println(rs.getString("TYPE_NAME"));
        }
    }
}
